<DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">

    <title>企业管理</title>
    <base href="${rc.contextPath}/">
<#include "/commons/stylesheets.ftl">

    <!-- Data Tables -->
    <link href="/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="/layer/skin/layer.css" rel="stylesheet">
    <style type="text/css">
        #toolbar button {
            margin-right: 10px;
        }
    </style>
    <script type="text/javascript">
        var CompanyType = {"1":"银行","2":"4S店","3":"保险公司","4":"修理厂","5":"汽配厂商","":"其他"};
        function search(){
            $("#table").bootstrapTable("refresh",{query:serializeForm("#form-search")});
        }
        
        function select(){
        	var  rows = $("#table").bootstrapTable("getSelections");
        	for(var i=0;i<rows.length;i++){
	            var html = "<label class='checkbox-inline'> <input checked = 'true' value='"+ rows[i]['customId'] + "' username='"+ rows[i]['middleName'] +"' type='checkbox'>"+ rows[i]["middleName"] +"</label>";                            
        		$("#selected").append(html);
        	}
        }
        
        function returns(){
        	var ids = "";
        	var names = "";
        	
        	var checks = $("#selected").find("input");
        	
        	for(var i=0;i<checks.length;i++){
        		ids = ids + $(checks[i]).val() +",";
        		names = names + $(checks[i]).attr("username") +",";
        	}
        	
        	
        	window.parent.setUser(ids,names,'1');
        	window.parent.layer.closeAll();
        }
        
         var start = {
            elem: "#start",
            format: "YYYY/MM/DD hh:mm:ss",
            min: laydate.now(),
            max: "2099-06-16 23:59:59",
            istime: true,
            istoday: false,
            choose: function (a) {
                end.min = a;
                end.start = a
            }
        };
        var end = {
            elem: "#end",
            format: "YYYY/MM/DD hh:mm:ss",
            min: laydate.now(),
            max: "2099-06-16 23:59:59",
            istime: true,
            istoday: false,
            choose: function (a) {
                start.max = a
            }
        };
        laydate(start);
        laydate(end);


        var Organizations={};
        function initOrganization(){
            $.getJSON("company/queryOrganization", function (list) {
                var parent;
                for (var i = 0; i < list.length; i++) {
                    row = list[i];
                    Organizations[row.organizationId] = row.name;
                }
            });
        }
        

        function formatCompanyType(value,row,index){
            return CompanyType[value]
        }

        function formatOrganization(value,row,index){
            return Organizations[value]
        }

        function refreshTable(){
            $("#table").bootstrapTable("refresh");
        }
    </script>
</head>

<body >
<div class="wrapper wrapper-content">

	<div class="row">
		
            <div class="ibox-content">
            
            	<form role="form" class="form-horizontal">
                        <div class="col-sm-12">
                            <div class="row">
                                <div class="form-group">
                                   
	                                <label class="col-sm-2 control-label">已选择</label>
	
	                                <div class="col-sm-10" id="selected">
	                                   
	                                </div>
                                   
                                </div>
                                <div class="form-group">
                                    <button class="btn btn-primary" type="button" style="margin-left: 20px;" onclick="returns()">选定</button>
                                </div>
                            </div>
                        </div>

                    </form>
            </div>
        
    </div>

	<div class="row">
           <#include "customerVehicleList.ftl">
    </div>

</div>


	<!-- 全局js -->
<#include "/commons/scripts.ftl">
    <script src="/layer/layer.js"></script>
    <script src="/js/app.js"></script>



    <script type="text/javascript" src="/bootstrap-table/bootstrap-table.min.js"></script>
    <script type="text/javascript" src="/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>



    <!-- Page-Level Scripts -->
    <script>
       $(function(){$("#table").bootstrapTable({locale:'zh-CN'})});

    </script>

</body>

</html>